package com.resource.manager.util;


import cn.hutool.core.bean.copier.BeanCopier;
import com.resource.manager.search.vo.FileType;
import com.resource.manager.search.vo.FileTypeEntity;

import java.util.*;

public class BeanCopyUtil {

    public static <T> T copy(Object source, Class<T> clazz){
        try {
            T t = clazz.getConstructor().newInstance();
            return BeanCopier.create(source,t,null).copy();
        }catch (Exception e){
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        }
    }

    public static <T> List<T> copyList(List<?> source, Class<T> clazz){
        List<T> result = new ArrayList<>();
        for(Object s : source){
            result.add(copy(s,clazz));
        }
        return result;
    }

    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.containsKey(null);
        System.out.println();
    }
}
